﻿@model IEnumerable<Citi.GocAttributes.WebUI.Models.TypeRuleResultModel>
@functions {
    private DatabaseEnums.TypeResultType type;
}
@using Citi.GocAttributes.Domain;
@{
    ViewBag.Title = "O&T Attributes";
}

@{
    type = (DatabaseEnums.TypeResultType)Enum.Parse(typeof(DatabaseEnums.TypeResultType), Request.QueryString["type"]); 
}
<h1>@type.GetDescription()</h1>
@section Head
{
    <script type="text/javascript">
        $(function () {
            $("#otAttributesOpenForm").html('<i class="icon-plus"></i>&nbsp;&nbsp;&nbsp;Create new');
        });
    </script>
}
@section Menu
{
    @Html.Partial("~/Views/Menu/Rules.cshtml", type)
}
<br />
@Ajax.ActionLink("Create new", "Form",
        new { type = type, id = (int?)null },
                new AjaxOptions { UpdateTargetId = "otAttributesForm", OnBegin = "$('#otAttributesCreate').modal('toggle')", OnSuccess= "$('#Value').focus()" },
    new { @class = "btn", id = "otAttributesOpenForm" })
<br />
<br />
<div id="otAttributesCreate" class="modal hide">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">
            ×</button>
        <h5>
            Create new</h5>
    </div>
    <div class="modal-body" id="otAttributesForm">
    </div>
</div>
<div id="otAttributesList">
    @Html.Partial("~/Views/TypeRuleResult/List.cshtml", Model)
</div>
